﻿<Window x:Class="Brjnk.GpxExplorer.UI.CreateRouteWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:l="clr-namespace:Brjnk.GpxExplorer.Localization"
        xmlns:common="clr-namespace:Brjnk.Common;assembly=Common"
        xmlns:vm="clr-namespace:Brjnk.GpxExplorer.ViewModel"
        FocusManager.FocusedElement="{Binding ElementName=txbName}"
        WindowStartupLocation="CenterOwner"
        Title="{l:Loc titleCreateRoute}" Height="500" MinWidth="400"
        DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <StackPanel Grid.Column="1" Grid.RowSpan="2">
            <Button Content="{l:Loc ok}" Click="Button_Click_1" Name="okButton" IsDefault="True" />
            <Button Content="{l:Loc cancel}" Click="Button_Click" IsCancel="True" />
        </StackPanel>

        <StackPanel Grid.Column="1" Grid.Row="3" Grid.RowSpan="2">

            <Button Content="{l:Loc createRouteUp}" Click="Button_Click_2" />
            <Button Content="{l:Loc createRouteDown}" Click="Button_Click_3" />

            <Border Height="10" />

            <Button Content="{l:Loc createRouteSelectAll}" Click="Button_Click_4" />
            <Button Content="{l:Loc createRouteSelectNothing}" Click="Button_Click_5" />
        </StackPanel>

        <TextBlock Text="{l:Loc createRouteName}" Name="txbName" />
        <TextBox Grid.Row="1" Style="{StaticResource HeaderTextBoxStyle}" Text="{Binding RouteName, UpdateSourceTrigger=PropertyChanged}" />
        <TextBlock Grid.Row="2" Text="{l:Loc createRouteSelectPoints}" />

        <ListView Grid.Row="3" Name="lv" ItemsSource="{Binding Items}">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="IsSelected" Value="{Binding IsSelected}" />
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <CheckBox IsChecked="{Binding IsChecked}"
                                  TextBlock.Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListViewItem}, Path=(TextBlock.Foreground)}" />
                        <ContentControl Grid.Column="1" Content="{Binding Object}" ContentTemplate="{StaticResource WaypointImportTemplate}">
                        </ContentControl>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

        <TextBlock Grid.Row="4" Grid.ColumnSpan="2" Text="{l:Loc createRouteTotalDistance, Binding={Binding TotalDistance}}" />
    </Grid>
</Window>